/*
 * @Autor: 黄旗
 * @Date: 2020-06-02 17:47:26
 */
import request from '@/plugins/request';
import dayjs from "dayjs";
// 任务列表
export function worktasklist (data) {
    let datas = { ...data };
    if (data.start_time) {
        datas.start_time = dayjs(data.start_time).format("YYYY-MM-DD");
    }
    if (data.end_time) {
        datas.end_time = dayjs(data.end_time).format("YYYY-MM-DD");
    }
    return request({
        url: '/v1/work/task/list',
        method: 'get',
        params: datas
    });
}
// 任务详情
export function worktaskinfo (data) {
    return request({
        url: '/v1/work/task/info',
        method: 'get',
        params: data
    });
}
// 编辑任务详情
export function worktaskeditinfo (data) {
    return request({
        url: '/v1/work/task/edit-info',
        method: 'get',
        params: data
    });
}
// 筛选任务患者信息
export function worktaskpatientres (data) {
    let datas = { ...data };
    if (data.start_reg_time) {
        datas.start_reg_time = dayjs(data.start_reg_time).format("YYYY-MM-DD");
    }
    if (data.end_reg_time) {
        datas.end_reg_time = dayjs(data.end_reg_time).format("YYYY-MM-DD");
    }
    if (data.start_last_callback_time) {
        datas.start_last_callback_time = dayjs(data.start_last_callback_time).format("YYYY-MM-DD");
    }
    if (data.end_last_callback_time) {
        datas.end_last_callback_time = dayjs(data.end_last_callback_time).format("YYYY-MM-DD");
    }
    return request({
        url: '/v1/work/task/patient-res',
        method: 'get',
        params: datas
    });
}
// 任务提醒信息
export function worktaskremindinfo (data) {
    return request({
        url: '/v1/work/task/remind-info',
        method: 'get',
        params: data
    });
}
// 新增任务
export function worktaskcreate (data) {
    let datas = { ...data };
    if (data.start_reg_time) {
        datas.start_reg_time = dayjs(data.start_reg_time).format("YYYY-MM-DD");
    }
    if (data.end_reg_time) {
        datas.end_reg_time = dayjs(data.end_reg_time).format("YYYY-MM-DD");
    }
    if (data.start_last_callback_time) {
        datas.start_last_callback_time = dayjs(data.start_last_callback_time).format("YYYY-MM-DD");
    }
    if (data.end_last_callback_time) {
        datas.end_last_callback_time = dayjs(data.end_last_callback_time).format("YYYY-MM-DD");
    }
    if (data.start_time) {
        datas.start_time = dayjs(data.start_time).format("YYYY-MM-DD");
    }
    if (data.end_time) {
        datas.end_time = dayjs(data.end_time).format("YYYY-MM-DD");
    }
    return request({
        url: '/v1/work/task/create',
        method: 'post',
        data:datas
    });
}
// 编辑任务
export function worktaskupdate (data) {
    let datas = { ...data };
    if (data.start_reg_time) {
        datas.start_reg_time = dayjs(data.start_reg_time).format("YYYY-MM-DD");
    }
    if (data.end_reg_time) {
        datas.end_reg_time = dayjs(data.end_reg_time).format("YYYY-MM-DD");
    }
    if (data.start_last_callback_time) {
        datas.start_last_callback_time = dayjs(data.start_last_callback_time).format("YYYY-MM-DD");
    }
    if (data.end_last_callback_time) {
        datas.end_last_callback_time = dayjs(data.end_last_callback_time).format("YYYY-MM-DD");
    }
    if (data.start_time) {
        datas.start_time = dayjs(data.start_time).format("YYYY-MM-DD");
    }
    if (data.end_time) {
        datas.end_time = dayjs(data.end_time).format("YYYY-MM-DD");
    }
    return request({
        url: '/v1/work/task/update',
        method: 'post',
        data:datas
    });
}
// 关闭任务
export function worktaskclose (data) {
    return request({
        url: '/v1/work/task/close',
        method: 'post',
        data
    });
}
// 删除任务
export function worktaskdelete (data) {
    return request({
        url: '/v1/work/task/delete',
        method: 'post',
        data
    });
}
// 设置任务提醒
export function worktaskremind (data) {
    return request({
        url: '/v1/work/task/remind',
        method: 'post',
        data
    });
}
// 我的任务列表【工作台】
export function worktaskmylist (data) {
    return request({
        url: '/v1/work/task/my-list',
        method: 'get',
        params: data
    });
}
// 任务数tab统计【工作台】
export function worktaskmylisttotal (data) {
    return request({
        url: '/v1/work/task/my-list-total',
    });
}
// 任务患者列表【工作台】
export function worktaskpatientlist (data) {
    return request({
        url: '/v1/work/task/patient-list',
        method: 'get',
        params: data
    });
}
